<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
  <head>
    <title>销售员分析</title>
    <jsp:include page="header.jsp"></jsp:include>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
    	.layui-col-md4 .my-select {
    		width: 80%;
    		margin-left: 10px;
    	}
    </style>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">系统统计</a>
        <a>
          <cite>销售员销量分析</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="/admin/saleManAnlayzy" method="post" id="listForm">
	        <input class="layui-input" placeholder="开始日" name="beginTime" id="start">
	         <input class="layui-input" placeholder="截止日" name="endTime" id="end">
	      	  <input type="text" name="id"  placeholder="请输入订单号" autocomplete="off" class="layui-input">
	          <input type="hidden" name="start" id="hh"/> 
	          <button class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
        <button class="layui-btn" onclick="exportExcel()">导出excel</button>
        <span class="x-right" style="line-height:40px">共有数据：${total} 页</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>订单号</th>
            <th>产品名称</th>
            <th>图片</th>
            <th>订单总价</th>
            <th>购买数量</th>
            <th>销售员</th>
           	<th>操作</th>
            </tr>
        </thead>
        <tbody>
        <c:if test="${not empty list}">
      	<c:forEach var="app" items="${list}" varStatus="st">
          <tr>
            <td>
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
	            </td>
	            <td>${app.id}</td>
	            <td>${app.goodsName}</td>
	            <td><img src="${pageContext.request.contextPath }${app.goodsPic}" alt="" width="70" height="50" /></td>
	            <td>${app.orderTotal}</td>
	            <td>
	            <%-- <span><c:choose>  
		  			<c:when test="${app.orderState==1}"> 
		  				未支付  
		  			</c:when> 
		  			<c:when test="${app.orderState==2}"> 
		  				未审核
		  			</c:when>
		  			<c:when test="${app.orderState==3}"> 
		  				已审核  
		  			</c:when>
		  			<c:when test="${app.orderState==4}">
		  				未发货   
		  			</c:when>
					<c:when test="${app.orderState==5}"> 
		  				已发货 
		  			</c:when>
		  			<c:when test="${app.orderState==6}"> 
		  				已完成
		  			</c:when>
		  			<c:when test="${app.orderState==7}"> 
		  				已退货
		  			</c:when>
			  			<c:when test="${app.orderState==8}"> 
			  				审核不通过
			  			</c:when>
			  <c:otherwise> 
			  	订单出问题  
			  </c:otherwise> 

			</c:choose> 
		</span> --%>
		${app.orderSum}
	            </td>
	            <td>${app.houseName}</td>
	            <td class="td-manage">
	              <a title="打印"  onclick="x_admin_show('审核','/admin/orderPrint?id=${app.id}',600,400)" href="javascript:;">
	                <i class="layui-icon">&#xe633;</i>
	              </a>
	            </td>
          </tr>
          </c:forEach>
	      </c:if>
        </tbody>
      </table>
      <div class="page">
        <div>
          <a class="my-first" href="javascript:;">
          	首页</a>
          <a class="prev" href="javascript:;">上一页</a>
          <a class="next" href="javascript:;">下一页</a>
          <a class="my-last" href="javascript:;">末页</a>
        </div>
      </div>

    </div>
    <script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start',
          type: 'datetime'
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end',
          type: 'datetime'
        });
      });
		$('.my-first').click(function(){
			var page =${page};
			if(page>1){
				$("#hh").val(1);
				$("#listForm").submit();
			}
		});
		$('.prev').click(function(){
			var page =${page};
			if(page>=2){
				$("#hh").val(page-1);
				$("#listForm").submit();
			}
		});
		$('.next').click(function(){
			var page =${page};
			var total=${total};
			if(total>=2){
				$("#hh").val(page+1);
				$("#listForm").submit();
			}
		});
		$('.my-last').click(function(){
			var page =${page};
			var total=${total};
			if(total>=2){
				$("#hh").val(total);
				$("#listForm").submit();
			}
		});
		
		function exportExcel(){
			///admin/exportExcel
			var beginTime =$("input[name='beginTime']").val();
			var endTime =$("input[name='endTime']").val();
			var saleMan=$("input[name='saleMan']").val();
			var url="/admin/exportSaleManExcel?beginTime="+beginTime+"&endTime="+endTime+"&saleMan="+saleMan;
			window.location.href=url;
		}
    </script>
  </body>

</html>